function resizePanel(PanelName, hasMenu) {
    var clientHeight = getViewportHeight();
    var clientWidth = getViewportWidth();

    resizePanelTo(PanelName, hasMenu, clientWidth, clientHeight);
}


function resizePanelTo(PanelName, hasMenu, pWidth, pHeight) {

    panelWidth = pWidth;
    contentHeight = pHeight - 46;

    if (hasMenu) contentHeight = contentHeight - 34;

    document.getElementById(PanelName).style.width = panelWidth + "px";
    if (pHeight > 0)
        document.getElementById(PanelName).style.height = pHeight + "px";
    
    var panelContent = document.getElementById(PanelName + '_content');
    if (panelContent != null) {
        if (panelWidth > 0)
            panelContent.style.width = (panelWidth - 6) + "px";
        if (contentHeight > 0)
            panelContent.style.height = contentHeight + "px";
    }

    if (hasMenu && panelWidth > 0) {
            scrollwidth = panelWidth - 35;
            document.getElementById(PanelName + "_menu").style.width = scrollwidth + "px";
            document.getElementById(PanelName + "_menu_slh").style.width = scrollwidth + "px";
            document.getElementById(PanelName + "_menubackground").style.width = (panelWidth - 2) + "px";
    }
}
